﻿<sap:ActivityDesigner x:Class="WFDataBaseProject.UCExecuteStoredProcedureActivityDesigner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:helpers="clr-namespace:WFDataBaseProject.Helpers"
    xmlns:s="clr-namespace:System;assembly=mscorlib"
    xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"                  
    xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
    xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation">
    <sap:ActivityDesigner.Resources>
        <sapc:ArgumentToExpressionConverter x:Key="argumentToExpressionConverter"/>
        <!--Collapsed mode-->
        <DataTemplate x:Key="expanded">
            <StackPanel Orientation="Vertical">
                <!--Connection type-->
                <TextBlock Text="Connection type(TypeOfConnection):"/>
                <sapv:ExpressionTextBox HintText="Enter connection type"
                                    OwnerActivity="{Binding ModelItem}"
                                    Expression="{Binding ModelItem.ConnectionType,
                Mode=TwoWay,
                Converter={StaticResource argumentToExpressionConverter},
                ConverterParameter=In}"
                ExpressionType="{x:Type helpers:TypeOfConnection}"/>
                <!--Connection string-->
                <TextBlock Text="Connection string:"/>
                <sapv:ExpressionTextBox HintText="Enter connection string"
                                    OwnerActivity="{Binding ModelItem}"
                                    Expression="{Binding ModelItem.ConnectionString,
                Mode=TwoWay,
                Converter={StaticResource argumentToExpressionConverter},
                ConverterParameter=In}"
                ExpressionType="{x:Type s:String}"/>
                <!--Returned type-->
                <TextBlock Text="Returned type:"/>
                <sapv:ExpressionTextBox HintText="Enter  the returned type"
                                    OwnerActivity="{Binding ModelItem}"
                                    Expression="{Binding ModelItem.ReturnedType,
                Mode=TwoWay,
                Converter={StaticResource argumentToExpressionConverter},
                ConverterParameter=In}"
                ExpressionType="{x:Type helpers:TypeOfReturn}"/>
                <!--Source location-->
                <TextBlock Text="Source location(SqlSourceLocation):"/>
                <sapv:ExpressionTextBox HintText="Enter  the source location"
                                    OwnerActivity="{Binding ModelItem}"
                                    Expression="{Binding ModelItem.SourceLocation,
                Mode=TwoWay,
                Converter={StaticResource argumentToExpressionConverter},
                ConverterParameter=In}"
                ExpressionType="{x:Type helpers:SqlSourceLocation}"/>
                <!--Stored procedure name-->
                <TextBlock Text="Stored procedure:"/>
                <sapv:ExpressionTextBox HintText="Enter  the stored procedure name:"
                                    OwnerActivity="{Binding ModelItem}"
                                    Expression="{Binding ModelItem.StoredProcedureName,
                Mode=TwoWay,
                Converter={StaticResource argumentToExpressionConverter},
                ConverterParameter=In}"
                ExpressionType="{x:Type s:String}"/>

            </StackPanel>
        </DataTemplate>
        <!--Expanded mode-->
        <DataTemplate x:Key="collapsed">
            <TextBlock Text="Collapsed mode"/>
        </DataTemplate>
        <!--Style for activity designer-->
        <Style x:Key="displaymodestyle" TargetType="{x:Type ContentPresenter}">
            <Setter Property="ContentTemplate" Value="{DynamicResource expanded}"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=ShowExpanded}" Value="false">
                    <Setter Property="ContentTemplate" Value="{DynamicResource collapsed}"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>

    </sap:ActivityDesigner.Resources>
    <Grid>
        <ContentPresenter Style="{DynamicResource displaymodestyle}" Content="{Binding}" />
    </Grid>
</sap:ActivityDesigner>
